package com.zhang.server.mapper;

import com.zhang.server.controller.request.BaseRequest;
import com.zhang.server.controller.request.LoginRequest;
import com.zhang.server.controller.request.PasswordRequest;
import com.zhang.server.entity.Admin;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface AdminMapper {
//    @Select("select * from user;")
    List<Admin> list();

    List<Admin> listByCondition(BaseRequest baseRequest);

    // 生成用户表测试数据
    @Insert("insert into admin (username, phone, email, password) values (#{username}, #{phone}, #{email}, #{password})")
    Integer insertTestData(Admin admin);

    void save(Admin admin);

    Admin getById(Integer id);

    void update(Admin admin);

    void delete(Integer id);

    Admin getUsernameAndPassword(LoginRequest loginRequest);

    Admin getUsername(String username);

    int updatePassword(PasswordRequest passwordRequest);
}
